<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>检测</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<!-- 新 Bootstrap 核心 CSS 文件 
jQuery文件。务必在bootstrap.min.js 之前引入
 最新的 Bootstrap 核心 JavaScript 文件 -->
<link rel="stylesheet" href="./js/bootstrap_3.3.5/css/bootstrap.css">
<script src="./js/jquery_1.11/jquery-1.11.3.min.js"></script>
<script src="./js/bootstrap_3.3.5/js/bootstrap.js"></script>
<!-- highcharts  -->
<script src="./js/highcharts/highcharts.src.js"></script>
<!-- alert  -->
<link href="./js/select/select.css" rel="stylesheet">
</head>
<body>
	<div id="chart"></div>
	<script>
		//获取url中的参数
		function getUrlParam(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
			var r = window.location.search.substr(1).match(reg); //匹配目标参数
			if (r != null)
				return unescape(r[2]);
			return null; //返回参数值
		}
		var node = getUrlParam('node');
		var type = getUrlParam('type');
		var project = "/dt";
		var setting = {
			showLine : true,
			data : {
				key : {
					title : "mark"
				},
				simpleData : {
					enable : true
				}
			},
			callback : {

			}
		};
		function flushdata() {
			var option = {
				"plotOptions" : {
					"spline" : {
						"marker" : {
							"enabled" : false
						},
						"lineWidth" : 1,
						"states" : {
							"hover" : {
								"lineWidth" : 1
							}
						}
					}
				},
				"yAxis" : {
					"min" : 0,
					"title" : {
						"text" : ""
					}
				},
				"xAxis" : {
					"type" : "datetime",
					"title" : {}
				},
				"credits" : {
					"enabled" : false
				},
				"series" : [ {
					name : "",
				} ],
				"subtitle" : {
					"text" : ""
				},
				"title" : {
					"text" : ""
				},
				"chart" : {
					"zoomType" : "x",
					"type" : "spline",
					"height" : 300
				}
			}
			console.log("node", node);
			console.log("type", type);
			$.ajax({
				type : "POST",
				url : project + "/api/mn/om/queryTouchMetricData.do",
				data : {
					node : node,
					type : type,
					time : 3
				},
				dataType : 'json',
				success : function(res) {
					var sdata = res.data;
					var hdata = {};
					hdata.name = sdata.col;
					hdata.data = sdata.data;
					option.series[0] = hdata;
					option.title = {
						text : sdata.name
					};
					showinit(option);
				}
			})
		}
		function showinit(option) {
			$('#chart').highcharts(option);
		}
		flushdata();
	</script>

</body>
</html>